*&---------------------------------------------------------------------*
*& Report ztest03
*&---------------------------------------------------------------------*

report ztest03.

types: begin of ty_sflight.
         include type sflight.
types:   color type lvc_t_scol, " color 字段保存颜色
       end of ty_sflight.

data gt_sflight type standard table of ty_sflight.
data lo_column_price   type ref to cl_salv_column_table.

start-of-selection.
  select *
    into corresponding fields of table gt_sflight
    from sflight.

  try.
      cl_salv_table=>factory(
        importing   r_salv_table   = data(lo_salv)
        changing    t_table        = gt_sflight
      ).
    catch cx_salv_msg.
  endtry.

  lo_salv->get_functions(  )->set_all(  ).

  try.
      lo_column_price ?= lo_salv->get_columns(  )->get_column( 'PRICE' ).
      lo_column_price->set_color( value lvc_s_colo( col = 3 int = 1 inv = 0 ) ).
    catch cx_salv_not_found.
  endtry.

  lo_salv->display(  ).